<div class="panel panel-default" ng-controller="orderDetailCtrl">
	<div class="panel-heading">
		订票管理 / 订单列表 / 订单编号：{{order.orderNo}}
		<span style="float: right;margin-top: -7px;height: 0px">
			<button type="submit" class="btn m-b-xs w-xs btn-info" ng-if="tag!=3" ui-sref="{{url}}">返回</button>
		</span>
	</div>
	<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
	<div class="row wrapper m-n">
		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-body">订单详细</div>
			</div>
			<div class="table-responsive" style="margin-top:-20px">
				<table class="table table-striped b-t b-light">
					<tbody>
						<tr>
							<td>订单编号：{{order.orderNo}}</td>
							<td>订单类型：
								<span ng-if="order.type==1">订票订单</span>
							</td>
							<td>订单生成时间：{{order.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
						</tr>
						<tr>
							<td>订单状态：{{order.status | orderFilter}}</td>
							<td>支付状态：
								<span ng-if="order.paymentFlag==true">已支付</span>
								<span ng-if="order.paymentFlag==false">未支付</span></td>
							<td>票数：{{order.orderDetail.tickets}}张</td>
						</tr>
						<tr>
							<td>联系人姓名：{{order.orderDetail.contactName}}</td>
							<td>联系人电话：{{order.orderDetail.contactPhone}}</td>
							<td>保险总价格：{{order.orderDetail.insurancePrice| number:2}}</td>
						</tr>
						<tr>
							<td>应支付总价：{{order.totalPrice| number:2}}</td>
							<td>实际支付总价：{{order.payablePrice| number:2}}</td>
							<td>折扣信息：{{order.sales.subject}}</td>
						</tr>
						<tr>
							<td>车票类型：
								<span ng-if="order.orderDetail.immediate">电子客票</span>
								<span ng-if="!order.orderDetail.immediate">取票码</span>
							</td>
							<td>是否有投诉：{{order.complaintFlag==true?'是':'否'}}</td>
							<td>可获得积分：{{order.points}}</td>
						</tr>
						<tr>
							<td>订单支付方式：{{payname}}</td>
							<td colspan="2">备注：{{order.remark}}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>

		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-body">班次信息</div>
			</div>
			<div class="table-responsive" style="margin-top:-20px">
				<table class="table table-striped b-t b-light">
					<thead>
						<tr>
							<th>车次号</th>
							<th>始发城市</th>
							<th>始发客运站</th>
							<th>目的城市</th>
							<th>目的客运站</th>
							<th>发车日期</th>
							<th>发车时间</th>
							<th>车票总价</th>
							<th>座位号</th>
							<th>车次类型</th>

						</tr>
					</thead>
					<tbody>
						<tr>
							<td>{{order.orderDetail.shiftNo}}</td>
							<td>{{order.orderDetail.startCity}}</td>
							<td>{{order.orderDetail.startStation}}</td>
							<td>{{order.orderDetail.terminalCity}}</td>
							<td>{{order.orderDetail.terminalStation}}</td>
							<td>{{order.orderDetail.departureTime | date : 'yyyy-MM-dd'}}</td>
							<td>{{order.orderDetail.departureTime | date : 'HH:mm:ss'}}</td>
							<td>{{order.totalPrice | number:2}}</td>
							<td>{{order.orderDetail.seatsNo}}</td>
							<td>{{order.orderDetail.seatType}}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>

		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-body">子订单信息
					<span style="margin-left: 50px" has-authority="BOOKING_LIST_REFUND">
						<button type="submit" class="btn btn-success" ng-click="ok(order)" ng-disabled="flag==false" ng-show="hide">系统退款</button>
					</span>
					<span style="margin-left: 50px" has-authority="BOOKING_LIST_REFUND">
						<button type="submit" class="btn btn-success" ng-click="refund(order)" ng-disabled="show==false" ng-show="sd">人工退款</button>
					<span ng-show="sd" style="margin-left: 20px;color: red">此操作仅更变订单状态，还需要人工自行退款。</span>
					</span>
				</div>
			</div>
			<div class="table-responsive" style="margin-top:-20px">
				<table class="table table-striped b-t b-light">
					<thead>
						<tr>
							<th  ng-show="hide">系统退款</th>
							<th  ng-show="sd">人工退款</th>
							<th>子订单号</th>
							<th>状态</th>
							<th>乘客姓名</th>
							<th>乘客电话</th>
							<th>身份证号码</th>
							<th>总金额</th>
							<th>支付金额</th>
							<th>保险名称</th>
							<th>保险价格</th>
							<th>赔付价格</th>
							<th>车票单价</th>
							<th>座位号</th>
							<th>车票状态</th>
							<th ng-show="order.orderDetail.immediate">条形码</th>
							<th ng-show="!order.orderDetail.immediate">取票码</th>
						</tr>
					</thead>
					<tbody ng-repeat="sub in order.subOrders">
						<tr>
							<td ng-show="hide">
								<label class="i-checks m-b-none" ng-show="sub.status==3" has-authority="BOOKING_LIST_REFUND">
								<input id="{{sub.contact.id}}" name="checks" type="checkbox"  ng-model="checks" ng-click="check(sub.contact.id,checks)"><i></i>
								</label></td>
							<td ng-show="sd">
								<label class="i-checks m-b-none" ng-show="sub.status==9" has-authority="BOOKING_LIST_REFUND">
								<input id="{{sub.contact.id}}" name="checks" type="checkbox"  ng-model="checks" ng-click="checkSd(sub.contact.id,checks)"><i></i>
								</label>
							</td>
							<td>{{sub.orderNo}}</td>
							<td>{{sub.status | orderFilter}}</td>
							<td>{{sub.contact.name}}</td>
							<td>{{sub.contact.phone}}</td>
							<td>{{sub.contact.idCard}}</td>
							<td>{{sub.totalPrice|number:2}}</td>
							<td>{{sub.payablePrice|number:2}}</td>
							<td>
								<span ng-if="sub.insuranceFlag==true">{{sub.orderInsurance.name}}</span>
								<span ng-if="sub.insuranceFlag==false">未购买</span>
							</td>
							<td>
								<span ng-if="sub.insuranceFlag==true">{{sub.orderInsurance.price|number:2}}</span>
								<span ng-if="sub.insuranceFlag==false">无</span>
							</td>
							<td>
								<span ng-if="sub.insuranceFlag==true">{{sub.orderInsurance.payment|number:2}}</span>
								<span ng-if="sub.insuranceFlag==false">无</span>
							</td>
							<td>{{sub.product.price|number:2}}</td>
							<td>{{sub.product.seatNo}}</td>
							<td>
								<span ng-if="sub.product.status==1">未出票</span>
								<span ng-if="sub.product.status==2">检票待发车</span>
								<span ng-if="sub.product.status==3">已发车</span>
								<span ng-if="sub.product.status==4">结束</span>
								<span ng-if="sub.product.status==5">已退票</span>
							</td>
							<td ng-show="order.orderDetail.immediate">
								<span ng-if="sub.product.barcode"><a class="text-base label bg-info" tooltip="查看条形码" ng-click="barcodeOpen(sub)">查看条形码</a></span>
								<span ng-if="!sub.product.barcode">无</span>
							</td>
							<td ng-show="!order.orderDetail.immediate">
								<span ng-if="sub.product.code">{{sub.product.code}}</span>
								<span ng-if="!sub.product.code">无</span>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>

	</div>
</div>